
const svgCaptcha = require('svg-captcha');

//验证码
function codeModel() {
    return async (req, res) => {
        var captcha = svgCaptcha.create();
        req.session.codeText = captcha.text;//将验证码存储在session中
        // console.log(captcha.text);
        // console.log('111111:',req.session.codeText);

        res.type('svg');//设置MIME
        res.status(200).send(captcha.data);//将验证码图片返回给客户端
    };
}


module.exports = codeModel;